<?php
/********用户收藏页面********/
if(!is_user_logged_in()) {
	wp_redirect(site_url()."/wp-login.php");
	exit;
}
global $current_user,$userdata;
get_currentuserinfo();
$pagenum = isset( $_GET['pagenum'] ) ? intval( $_GET['pagenum'] ) : 1;
$now = ($pagenum-1)*20;
$total = get_user_fav_count($userdata->ID);
$total_page = ceil($total/20);
?>

<div class="member_system">
     <div class="title_member" >总共收藏<?php echo $total;?>篇文章</div>
     <ul class="item-list">
		<?php $check= "select * from ".$wpdb->prefix."userpost_fav where user='$userdata->ID' limit $now ,20";
        $coo = $wpdb->get_results($check);
        if(count($coo) > 0){
        foreach ($coo as $co) {
        $post_of_int=get_post($co->post);
        ?> 
        <li>
        <div class="user_list_title ">
            <div  class="length"style="float:left"  >
              <a href="<?php echo get_permalink($post_of_int->ID); ?>"><?php echo $post_of_int->post_title;?></a>
            </div>
            
         </div>   
        </li>
        <?php }} ?>
    </ul>
</div>


<div class="pageBox" >
<div class="page"  align="center" >
  <?php
$pagination = paginate_links( array(
	'base' => add_query_arg( 'pagenum', '%#%' ),
	'format' => '',
	'prev_text' => '上一页',
	'next_text' => '下一页',
	'total' => $total_page,
	'current' => $pagenum
	)
);
if ( $pagination ) {
	echo $pagination;
}
?>  </div>
<div class="clear"></div>
</div>